package com.fs.common;

import com.fs.common.exception.BaseErrorCodes;

/**
 * 错误信息
 */
public enum ErrorCodes implements BaseErrorCodes {
    BASE_PASSWORD_INVALID("A01001", "原密码错误"),
    BASE_WX_LOGIN_FAIL("A01002", "微信授权登录失败"),
    BASE_FILE_UPLOAD_FAILED("A01003", "文件上传失败"),

    // ---------------------------机构相关异常
    // 机构编码已存在
    // ---------------------------机构相关异常
    // 机构编码已存在
    BASE_DEPT_CODE_EXISTS("C01001", "机构编码重复"),
    // 机构不存在
    BASE_DEPT_NOT_EXISTS("C01002", "机构不存在"),
    BASE_DEPT_NAME_DUPLICATED_IN_PARENT("C01003", "机构名称重复"),
    BASE_DEPT_HAS_CHIlDREN("C01004", "机构下存在子机构"),

    // ---------------------------用户相关异常
    BASE_USER_USERNAME_OR_PHONE_EXISTS("C02001", "用户名或手机号重复"),
    BASE_USER_PHONE_EXISTS("C02002", "手机号已存在"),

    // ----------------------------字典相关异常
    BASE_DICT_CODE_EXISTS("C03001", "字典编码重复"),

    BASE_DICT_NAME_EXISTS("C03002", "字典名称重复"),

    BASE_DICT_ITEM_EXISTS("C03003", "字典项重复"),

    // -----------------------------菜单相关异常
    BASE_MENU_CODE_EXISTS("C04001", "菜单编码重复"),

    // 同一主菜单下子菜单名称重复
    BASE_MENU_NAME_EXISTS("C04002", "菜单名称重复"),

    // ------------------------------角色相关异常
    BASE_ROLE_EXISTS("C05001", "角色重复"),
    BASE_ROLE_CODE_EXISTS("C05002", "角色编码重复"),
    BASE_ROLE_NAME_EXISTS("C05003", "角色名称重复"),

    // -------------------------------系统配置项相关异常
    BASE_CONFIG_CODE_EXISTS("C06001", "配置项编码重复"),

    BASE_CLIENT_INVALID("C07001", "客户端无效"),
    BASE_CLIENT_DISABLED("C07002", "客户端已禁用"),

    // -------------------------------业务相关异常

    BASE_TENANT_NOT_EXISTS("T01001", "租户不在在"),
    APP_NOT_EXISTS("T01002", "应用不在在"),
    BASE_USER_NOT_IN_TENANT("T01003", "租户无效"),
    BASE_MESSAGE_NOT_CONFIG("T01004", "未配置短信发送渠道及模板，请联系超管进行配置"),
    BASE_MESSAGE_CHANNEL_NOT_SUPPORTED("T01005", "不支持的短信发送渠道"),
    BASE_SEND_PHONE_MESSAGE_FAILED("T01006", "短信发送失败"),
    BASE_USER_PHONE_NOT_EXISTS("T01007", "用户不存在"),

    IOT_DEVICE_CODE_DUPLICATED("D01001", "设备编码重复"),
    IOT_MODEL_FIELD_CODE_DUPLICATED("D01002", "模型属性重复"),
    IOT_GATEWAY_CODE_DUPLICATED("D01003", "网关编码重复"),
    IOT_MODEL_CODE_DUPLICATED("D01004", "模型编码重复"),
    IOT_GATEWAY_NOT_EXISTS("D01005", "网关不存在"),
    IOT_DEVICE_NOT_EXISTS("D01006", "设备不存在"),
    IOT_MODEL_NOT_EXISTS("D01007", "模型不存在"),
    IOT_MODEL_FIELDS_EMPTY("D01008", "模型属性为空，请导入或维护模型属性"),
    IOT_MODEL_IMPORT_CATEGORY_EMPTY("D01009", "分类名称不能为空"),
    IOT_MODEL_IMPORT_NAME_EMPTY("D01010", "模型名称不能为空"),
    IOT_MODEL_IMPORT_CODE_OR_NAME_EMPTY("D01011", "模型编码或名称不能为空"),
    IOT_ALARM_DEFINE_NOT_EXISTS("D11001", "报警规则定义不存在");

    private final String code;
    private final String msg;

    ErrorCodes(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }


}
